package design.mode.model.strategy.strategy;

import design.mode.model.strategy.annotation.Business;
import design.mode.model.strategy.strategy.bean.ChatBean;
import design.mode.model.strategy.biz.AbstractBiz;
import design.mode.model.strategy.busenum.BusinessTypeEnum;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.stereotype.Component;
import java.util.Map;

/**
 * 定义具体的策略类
 * @author ldanniel
 */
@Component
@Business(BusinessTypeEnum.CHAT_MSG_001)
public class ChatProcessStrategy extends AbstractBiz<ChatBean> {


    @Override
    public ChatBean buildBean(Map<String, Object> paramMap) {
        ChatBean chatBean = new ChatBean();
        try {
            BeanUtils.copyProperties(chatBean,paramMap);
        } catch (Exception e) {
           System.out.println("注入属性失败");
        }
        return chatBean;
    }

    @Override
    public Object callBiz(ChatBean chatBean) {
        System.out.println("开始执行ChatProcessStrategy方法");
      return   "Chat msg: 开始执行ChatProcessStrategy方法";
    }
}
